package coco.mogodb.com.module.drug.entity;

import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.CompoundIndexes;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * *@CompoundIndexes
 * name：索引名称 def：字段(1正序 -1倒序，排序用) unique：是否唯一索引
 * 直接加到字段上面没用
 */
@Data
@ToString
@Accessors(chain = true)
@Document(collection = "t_m_pharmacy_drugs")
@CompoundIndexes({
        @CompoundIndex(name = "uq_userno_date", def = "{cjId:1, cjType:-1}", unique = true)
})
public class PharmacyDrugs implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 指定主键字段，注意import是javax持久化的Id而非springboot annotation的Id
     * *@Field("id")指定该主键名称为id
     * 如果不添加此项注解的话，程序会认为private int id字段对应的是mongodb集合中的objectid字段（该字段是mongodb中的默认主键）
     */
    @Id
    @Field("id")
    private String id;

    private String cjId;

    private Integer cjType;

    private String pPxId;

    private String pAppId;

    private Integer pDbType;

    private String drugsTypeId;

    private Integer useStatus;

    private String appId;

    private String name;

    private String type;

    private String nature;

    private String packingSpec;

    private Double price;

    private Double purchasePrice;

    private String approvalNum;

    private String usageDosage;

    private String manufacturer;

    private String barcode;

    private Integer useRate;

    private String unit;

    private String singleDosage;

    private String quantityUnit;

    private String drugsRoute;

    private String drugsInteval;

    private String antibioticRemark;

    private Double bounty;

    private String drugsId;

    private Integer rec;

    private Integer stock;

    private String controlPin;

    private Double rebate;

    private String oldCjId;

    private Integer isDelete;

    private LocalDateTime createTime;

    private LocalDateTime modifyTime;
}
